package com.byq.mm.application.cluster.server;


import com.byq.mm.abstractx.cluster.server.ClusterServer;
import com.byq.mm.abstractx.device.Device;
import com.byq.mm.abstractx.engine.CoreEnvironment;
import com.byq.mm.abstractx.protocol.Interaction;
import com.byq.mm.application.cluster.provider.PictureProvider;
import com.byq.mm.application.cluster.server.executor.PictureExecutor;


public class PictureServer extends ClusterServer {

	public PictureServer(String cluster, Device device, CoreEnvironment env) {
		super(cluster, device, env);
		// TODO Auto-generated constructor stub
	}

	@Override
	public boolean onCommand(Interaction i, String transport) {
		PictureExecutor exe = getExecutor();
		if(exe == null)
			return false;
		if(i.command.equals(PictureProvider.Define.ClientCommand.FORCE)){
			exe.force(i.from, transport);
			return true;
		}
		if(i.command.equals(PictureProvider.Define.ClientCommand.REQUEST)){
			exe.request(i.from, transport);
			return true;
		}
		return false;
		
	}
	public void onPicture(byte[] value){
		
	}
	@Override
	public PictureExecutor getExecutor(){
		return (PictureExecutor)super.getExecutor();
		
	}


}
